#include "genomeelementdatapacket.h"

//-------------------------------CONSTRUCTORS ------------------------------------------
GenomeElementDataPacket::GenomeElementDataPacket(QObject *parent) :
    QObject(parent)
{
}

GenomeElementDataPacket::GenomeElementDataPacket( QString seqId, QString source, QString type, int start, int stop, bool posStrand,
                                                  QString parentContigId, bool hasCluster, QString clusterId,
                                                  bool hasSpecies, QString species, QObject *parent)
                                    : seqId(seqId), source(source), type(type), start(start), stop(stop), posStrand(posStrand),
                                      parentContigId( parentContigId ), hasCluster(hasCluster), clusterId(clusterId),
                                      hasSpecies(hasSpecies), species(species), QObject(parent )
{


}

//-------------------------------SETTERS ------------------------------------------
void GenomeElementDataPacket::setAll( QString seqId, QString source, QString type, int start, int stop, bool posStrand,
                                      QString parentContigId, bool hasCluster, QString clusterId,
                                      bool hasSpecies, QString species)
{
    setSeqId( seqId );
    setSource( source );
    setType( type );
    setStart( start );
    setStop( stop );
    setPosStrand( posStrand );
    setParentContigId( parentContigId );
    setHasCluster( hasCluster );
    setClusterId( clusterId );
    setHasSpecies( hasSpecies );
    setSpecies( species );
}

void GenomeElementDataPacket::setSeqId( QString seqId )
{
    this->seqId = seqId;
}

void GenomeElementDataPacket::setSource( QString source )
{
    this->source = source;
}

void GenomeElementDataPacket::setType( QString type )
{
    this->type = type;
}

void GenomeElementDataPacket::setStart( int start )
{
    this->start = start;
}

void GenomeElementDataPacket::setStop( int stop )
{
    this->stop = stop;
}

void GenomeElementDataPacket::setPosStrand( bool posStrand )
{
    this->posStrand = posStrand;
}

void GenomeElementDataPacket::setParentContigId( QString parentContigId )
{
    this->parentContigId = parentContigId;
}

void GenomeElementDataPacket::setHasCluster( bool hasCluster )
{
    this->hasCluster = hasCluster;
}

void GenomeElementDataPacket::setClusterId( QString clusterId )
{
    this->clusterId = clusterId;
}

void GenomeElementDataPacket::setHasSpecies( bool hasSpecies )
{
    this->hasSpecies = hasSpecies;
}


void GenomeElementDataPacket::setSpecies( QString species )
{
    this->species = species;
}

//-------------------------------GETTERS ------------------------------------------

QString GenomeElementDataPacket::getSeqId( )
{
    return seqId;
}

QString GenomeElementDataPacket::getSource( )
{
    return source;
}

QString GenomeElementDataPacket::getType( )
{
    return type;
}

int GenomeElementDataPacket::getStart( )
{
    return start;
}

int GenomeElementDataPacket::getStop( )
{
    return stop;
}

bool GenomeElementDataPacket::getPosStrand( )
{
    return posStrand;
}

QString GenomeElementDataPacket::getParentContigId( )
{
    return parentContigId;
}

bool GenomeElementDataPacket::getHasCluster( )
{
    return hasCluster;
}

QString GenomeElementDataPacket::getClusterId( )
{
    return clusterId;
}

bool GenomeElementDataPacket::getHasSpecies( )
{
    return hasSpecies;
}

QString GenomeElementDataPacket::getSpecies( )
{
    return species;
}

//------------------------DISPLAY GETTERS---------------------
QString GenomeElementDataPacket::getIdentifierToDisplay()
{
    return seqId;
}

QString GenomeElementDataPacket::getDataToDisplay()
{
    QString toReturn = "SeqId:  " + getSeqId();
    toReturn += "\nSource:  " + getSource();
    toReturn += "\nType:  " + getType();
    toReturn += "\nLength (nt):  " + QString::number(getStop() - getStart() + 1);
    toReturn += "\nStrand:  " + QString(getPosStrand()?"+":"-");
    if( getHasCluster() )
        toReturn += "\nClusterId: " + getClusterId();
    //toReturn += "\nCluster Id:  " + getClusterId();
    return toReturn;
}

QString GenomeElementDataPacket::toString( )
{
    return getSeqId() + "\t" + getSource() + "\t" + getType() + "\t" + QString::number(getStart()) + "\t" + QString::number(getStop()) + "\t" + QString(getPosStrand()?"T":"F")
            + "\t" + getParentContigId() + "\t" + QString(getHasCluster()?"T":"F")  +  "\t"
            + getClusterId() + "\t" +  QString(getHasSpecies()?"T":"F")  + "\t" + getSpecies();
}

QString GenomeElementDataPacket::getUniqueId()
{
    return seqId;
}


